package tagcloud.gui;

import java.awt.GridBagLayout;
import javax.swing.JPanel;
import javax.swing.BorderFactory;
import javax.swing.JLabel;
import java.awt.GridBagConstraints;
import javax.swing.SwingConstants;
import javax.swing.JProgressBar;

import java.awt.event.KeyEvent;
import java.awt.Dimension;

public class ProgressPanel extends JPanel {

	private static final long serialVersionUID = 1L;
	private JLabel messageLabel = null;
	private JProgressBar progressBar = null;
	
	/**
	 * This is the default constructor
	 */
	public ProgressPanel() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
		gridBagConstraints5.gridx = 0;
		gridBagConstraints5.fill = GridBagConstraints.BOTH;
		gridBagConstraints5.gridy = 1;
		GridBagConstraints gridBagConstraints = new GridBagConstraints();
		gridBagConstraints.gridx = 0;
		gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
		gridBagConstraints.weightx = 1.0D;
		gridBagConstraints.gridy = 0;
		messageLabel = new JLabel();
		messageLabel.setText("MESSAGE");
		messageLabel.setDisplayedMnemonic(KeyEvent.VK_UNDEFINED);
		messageLabel.setHorizontalAlignment(SwingConstants.CENTER);
		this.setSize(640, 480);
		this.setLayout(new GridBagLayout());
		this.setBorder(BorderFactory.createEmptyBorder(0, 192, 0, 192));
		this.setName("Progress Panel");
		this.add(messageLabel, gridBagConstraints);
		this.add(getProgressBar(), gridBagConstraints5);
	}

	/**
	 * This method initializes progressBar	
	 * 	
	 * @return javax.swing.JProgressBar	
	 */
	private JProgressBar getProgressBar() {
		if (progressBar == null) {
			progressBar = new JProgressBar();
			progressBar.setPreferredSize(new Dimension(148, 20));
			progressBar.setStringPainted(false);
			progressBar.setIndeterminate(true);
		}
		return progressBar;
	}
	
	protected void setMessage(String message) {
		messageLabel.setText("<HTML>" + message + "</HTML>");
	}

}
